package com.beauty.dressing.module.common.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;

import com.beauty.dressing.R;
import com.framework.common.utils.ICommonUtil;

/**
 * 帖子回帖按钮
 * @author Angus
 * @company jxgis.com
 */
public class ReplyArea extends PraiseArea {
    private Listener commentListener;

    private boolean showDefaultTxt = true;

    public void setShowDefaultTxt(boolean showDefaultTxt) {
        this.showDefaultTxt = showDefaultTxt;
    }

    public ReplyArea(Context context) {
        super(context);
    }

    public ReplyArea(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public ReplyArea(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }


    @Override
    public int defaultImageSrc() {
        return R.drawable.comment_icon;
    }

    public void setCommentListener(Listener commentListener) {
        this.commentListener = commentListener;
    }

    public void setCommentNum(int num) {
        if (0 == num) {
            numberTxt.setText(showDefaultTxt ? "评论" : "");
        } else {
            numberTxt.setText("评论"+String.valueOf(num));
        }
    }

    @Override
    public void onClick(View v) {
        if (null == commentListener || ICommonUtil.isFastDoubleClick()) {
            return;
        }
        commentListener.onCommentAreaClick();
    }

    public interface Listener {
        void onCommentAreaClick();
    }
}
